<template>
  <div id="app">
    <!-- 动态渲染组件，懒得去弄路由了 -->
    <keep-alive>
      <component :is="curDemo" />
    </keep-alive>
  </div>
</template>

<script>
import printCustom from "@/demo/custom/index";
// import printDesign from "@/demo/design/index";
import printTasks from "@/demo/preview";

export default {
  name: "App",
  components: {
    printCustom,
    // printDesign,
    printTasks,
  },
  data() {
    return {
      curDemo: "printCustom",
      // npm 信息
      npmInfo: {},
      versions: [],
      lang: "cn",
      // 选择版本
      version: undefined,
    };
  },
  created() {
    this.curDemo = this.getParamsByKey('page') || 'printCustom';
    this.version = sessionStorage.getItem("version") || "development";
    this.lang = sessionStorage.getItem("lang") || "cn";
  },
  methods: {
    getParamsByKey(key) {
      let url = location.href;
      let queryInfo = url.split('?')[1];
      let queryParams = new URLSearchParams('?'+queryInfo);
      return queryParams.get(key) || 0;
    },
  },
};
</script>

<style lang="less">
/* 隐藏滚动条的样式 */
::-webkit-scrollbar {
  display: none;
}
/* 在Firefox中隐藏滚动条 */
html {
  scrollbar-width: none; /* Firefox */
}
.w-full {
  width: 100%;
}
.h-full {
  height: 100%;
}
.h-min-screen {
  min-height: 100vh;
}
.h-max-screen {
  max-height: 100vh;
}
.h-screen {
  height: 100vh!important;
}
.bordered {
  border: 1px solid #e8e8e8;
}
.border-dotted {
  border-style: dotted!important;
}
.border-gray-400 {
  border-color: rgba(0,0,0,0.4);
}
.relative {
  position: relative;
}
.absolute {
  position: absolute;
}
.flex-col {
  display: flex!important;
  flex-direction: column;
}
.flex-row {
  display: flex!important;
  flex-direction: row;
}
.justify-start {
  display: flex;
  justify-content: flex-start;
}
.justify-center {
  display: flex;
  justify-content: center;
}

.justify-end {
  display: flex;
  justify-content: flex-end;
}
.justify-evenly {
  display: flex;
  justify-content: space-evenly;
}
.justify-around {
  display: flex;
  justify-content: space-around;
}
.justify-between {
  display: flex;
  justify-content: space-between;
}
.align-start {
  display: flex;
  align-items: flex-start;
}
.align-center {
  display: flex;
  align-items: center;
}
.align-end {
  display: flex;
  align-items: flex-end;
}
.flex-wrap {
  flex-wrap: wrap;
}
.word-wrap {
  word-break: break-all;
}
.bg-white {
  background-color: #FFFFFF;
}
.p-2 {
  padding: 0.5rem;
}
.mt-0 {
  margin-top: 0;
}
.mt-2 {
  margin-top: 0.5rem;
}
.mt-4 {
  margin-top: 1rem;
}
.overflow-hidden {
  overflow: hidden;
}
.overflow-y-scroll {
  overflow-y: scroll!important;
}
.menus {
  padding: 10px 24px;
}

// hiprint 拖拽图片
.hiprint-printElement-image-content {
  img {
    content: url("~@/assets/logo.png");
  }
}

// 修改 页眉/页脚线 样式
.hiprint-headerLine,
.hiprint-footerLine {
  display: none;
  border-color: red !important;
}

.hiprint-headerLine:hover,
.hiprint-footerLine:hover {
  border-top: 3px dashed red !important;
}

.hiprint-headerLine:hover:before {
  content: "页眉线";
  left: calc(50% - 18px);
  position: relative;
  background: #ffff;
  top: -12px;
  color: red;
  font-size: 12px;
}

.hiprint-footerLine:hover:before {
  content: "页脚线";
  left: calc(50% - 18px);
  position: relative;
  color: red;
  background: #ffff;
  top: -12px;
  font-size: 12px;
}
.hiprint-paperNumber {
  display: none;
}
</style>
